package algorithms.prefix;

import java.util.Arrays;
import java.util.List;

public class Client {
    public static void main(String[] args) {
        List<String> words = Arrays.asList("abc", "abcd", "abcde", "abcdef", "abc", "ab");

        PriFixTree priFixTree = new PriFixTree();
        words.stream().forEach(e->priFixTree.insert(e));
        String word = "abc";
        System.out.println("以"+word+"为出现的次数:"+priFixTree.search(word));
        System.out.println("以"+word+"为前缀出现的次数:"+priFixTree.searchPrefix(word));
        priFixTree.remove(word);
        System.out.println("以"+word+"为出现的次数:"+priFixTree.search(word));
        System.out.println("以"+word+"为前缀出现的次数:"+priFixTree.searchPrefix(word));
    }
}
